import { $axios } from '@/utils/http';

// 买家获取订单表
export async function getOrderList(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/getOrderList',
    method: 'GET',
    params,
  });
}

// 商家获取订单表
export async function getBySaleId(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/getBySaleId',
    method: 'GET',
    params,
  });
}

// 根据id查找订单
export async function selectOrder(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/selectOrder',
    method: 'GET',
    params,
  });
}

// 删除订单
export async function removeOrder(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/removeOrder',
    method: 'POST',
    params,
  });
}

// 更改物流状态
export async function updState(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/updState',
    method: 'POST',
    params,
  });
}

// 商家退货签收
export async function finishReturn(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/finishReturn',
    method: 'POST',
    params,
  });
}

// 商家首页获取订单数量
export async function getOrderCount(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/getOrderCount',
    method: 'GET',
    params,
  });
}

// 获取柱状图数据
export async function getBar(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/getBar',
    method: 'GET',
    params,
  });
}

// 新建order订单（购物车结算）
export async function createOrder(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/createOrder',
    method: 'POST',
    params,
  });
}

// 新建order订单（直接购买）
export async function goBuy(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/orders/goBuy',
    method: 'POST',
    params,
  });
}
